import axios from "axios"; import type { NextApiHandler } from "next"; const userUpdate: NextApiHandler = async (req, res) => { const { id } = req.query; try { const response = await axios.put( `${process.env.PRISMA_API}/user/${id}`, req.body, { headers: { "Content-Type": "application/json" } } ); res.status(response.status).json(response.data); } catch (e) { if (axios.isAxiosError(e)) { res.status(e.response?.status || 500).json(e.response?.data); } else { res .status(500) .json({ message: "There was an error processing the request, please try again.", }); } } }; export default userUpdate;